#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5005;

string text;
int a[N], n;
void parse(string& s) {
  int len = s.size();
  int l = 0;
  while (l < len) {
    int h = l + 1;
    while (h < len && s[h] != '<') h++;
    string now = s.substr(l, h - l);
    int x = 0;
    if (now == "<table>") x = 1;
    if (now == "</table>") x = -1;
    if (now == "<td>") x = 2;
    if (now == "</td>") x = -2;
    if (x) a[++n] = x;
    l = h;
  }
}
int ans[N], num;
void solve() {
  string x;
  while (cin >> x) text += x;
  parse(text);
  stack<int> st;
  rep(i, 1, n) {
    if (a[i] == 1)
      st.push(++num);
    else if (a[i] == -1)
      st.pop();
    else if (a[i] == 2)
      ans[st.top()]++;
  }
  sort(ans + 1, ans + num + 1);
  rep(i, 1, num) cout << ans[i] << ' ';
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}